﻿//// JScript 文件
function DefaultPage(){   

     this.selectArray=new Array();
     var loader=new Ext.tree.TreeLoader({		url:"IPC.aspx"	});
    
     var root=new Ext.tree.TreeNode({
            id:"root",//根节点id
            text:"IPC",

            leaf:false,
            loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=root"	})

     });
     
      var a=new Ext.tree.AsyncTreeNode({
        id:'A',//子结点id
        text:'A',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=A"	})
      });
      var b=new Ext.tree.AsyncTreeNode({
        id:'B',//子结点id
        text:'B',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=B"	})
      });
      var c=new Ext.tree.AsyncTreeNode({
        id:'C',//子结点id
        text:'C',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=C"	})
      });
      var d=new Ext.tree.AsyncTreeNode({
        id:'D',//子结点id
        text:'D',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=D"	})
      });
      var e=new Ext.tree.AsyncTreeNode({
        id:'E',//子结点id
        text:'E',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=E"	})
      });

      var f=new Ext.tree.AsyncTreeNode({
        id:'F',//子结点id
        text:'F',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=F"	})
      });
      
      var g=new Ext.tree.AsyncTreeNode({
        id:'G',//子结点id
        text:'G',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=G"	})
      });
      var h=new Ext.tree.AsyncTreeNode({
        id:'H',//子结点id
        text:'H',
        checked:false,
        loader:new Ext.tree.TreeLoader({		url:"IPC.aspx?parent=H"	})
      });
      
      root.appendChild(a);//为根节点增加子结点c1
      root.appendChild(b);
      root.appendChild(c);
      root.appendChild(d);
      root.appendChild(e);
      root.appendChild(f);
      root.appendChild(g);
      root.appendChild(h);

     
      var tree=new Ext.tree.TreePanel({
            //renderTo:'left',
            title: '专利质量指标',
            animate:true, 
            autoScroll:true,                
            containerScroll: true,
            width: 200,
            height:477,
            root:root 
        });
    
    
    tree.on("beforeload",function(node,event){
    		node.loader=new Ext.tree.TreeLoader({		url:"IPC.aspx?parent="+node.id	});
    		});

    tree.on("checkchange",function(node,checked){
            if(checked)
            {
               selectArray.push(node.id);
            }
            else
            {
               for(var index=0; index<selectArray.length; index++)
               {
                   if(selectArray[index]==node.id)
                   {
                       selectArray.splice(index,1);
                   }
               }
            }
    		//node.loader=new Ext.tree.TreeLoader({		url:"IPC.aspx?parent="+node.id	});
    		});
    	
   

     var left=new Ext.Panel({
		el:"left",
		//title:'专利质量指标',
		width:200,
		height:477,
		//layout:"column",
		collapsible:true,
		collapseMode:'mini', //设置收缩模式为迷你模式,即中间一个小三角
		//region:"west",		
		items:[tree]
		
	});	
    
    function parseArray(array)
    {
         var returnValue="";
         for(var index=0; index<array.length; index++)
         {
              if(index==0)
              {
                   returnValue+=array[index];
              }
              else
              {
                   returnValue+=","+array[index];
              }
         }
         alert(returnValue);
    }

	left.render();
}

Ext.onReady(DefaultPage);
